<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 禁止浏览器缓存 --> 
<meta http-equiv="Pragma" content="no-cache"> 
<meta http-equiv="Cache-Control" content="no-cache"> 
<meta http-equiv="Expires" content="0"> 
<title>用户登录</title>
<link th:href="@{css/login.css}"  rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/myPlugin.js"></script>
<script type="text/javascript" src="js/commonUtil.js"></script>

<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
var ctxPath = [[@{/}]];  
	/*]]>*/
	

$(document).ready(function(){
	 $("#password_text").bind("click",function(){
		$(this).hide();
		$("#password").show();
		$("#password").focus();
	 });
	 
	 $("#password").keydown(function(event){
		 util.enterIn(event,function(){
			$("#loginbtn").click();
		 });	 
	 });
	 
	 
	$("#loginbtn").bind("click",function(){
		var userName=$("#userName").val();
		var password=$("#password").val();
		if(util.isEmptyStr(userName)){
			$("#login_result_info").text("请输入用户名");
			return;
		}
		
		if(util.isEmptyStr(password)){
			$("#login_result_info").text("请输入密码");
			return;
		}else if($.trim(password).length < 6){
			$("#login_result_info").text("密码位数不少于6位");
			return;
		}
		
		$.getJSON(ctxPath+"/loginUser",{"userName":userName,"password":password},function(response){
			if(response.returnCode=="success"){
				location.href = ctxPath+'/index';
			}else{
				$("#login_result_info").text(response.returnMessage);
			}
		});
		
		
	});
	
	
	
	
	
});
</script>
</head>

<body>


<div class="login_box">
      <div class="login_l_img"><img src="images/login-img.png" /></div>
      <div class="login">
          <div class="login_logo"><a href="javascript:void(0);"><img src="images/login_logo.png" /></a></div>
          <div class="login_name">
               <p th:text="后台管理系统"></p>
          </div>
          <div id="loginForm">
              <input id="userName" name="userName" type="text" autocomplete="off" value="用户名" onfocus="this.value=''" onblur="if(this.value==''){this.value='用户名'}"/>
              <span id="password_text">密码</span>
			  <input id="password" name="password" type="password"  autocomplete="off" style="display:none;" onblur="if(this.value==''){document.getElementById('password_text').style.display='block';this.style.display='none'};"/>
              <input id="loginbtn" value="登录" style="width:100%;" type="button"/>
          </div>
          <div class="login_result_info" id="login_result_info"></div>
      </div>
      <div class="copyright">魔尺信息技术有限公司版权所有©2018-2019 技术支持电话：027-86920000</div>
</div>
</body>
</html>
